// 显示选择头像弹层
import 'package:flutter/material.dart';

void ShowPhotoDialog(BuildContext ctx, Function callback) {
  showModalBottomSheet(
      context: ctx,
      builder: (context) {
        return SizedBox(
          width: double.infinity,
          height: 180,
          child: Column(
            children: [
              Container(
                alignment: Alignment.center,
                height: 60,
                decoration: const BoxDecoration(
                    border: Border(
                        bottom: BorderSide(width: 0.5, color: Colors.grey))),
                child: const Row(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    Icon(Icons.camera_alt),
                    SizedBox(
                      width: 10,
                    ),
                    Text(
                      "拍照",
                      style: TextStyle(fontSize: 20),
                    )
                  ],
                ),
              ),
              Container(
                alignment: Alignment.center,
                height: 60,
                decoration: const BoxDecoration(
                    border: Border(
                        bottom: BorderSide(width: 0.5, color: Colors.grey))),
                child: GestureDetector(
                    onTap: () {
                      // 弹出相册选择照片
                      callback(); // 选择照片
                    },
                    child: const Row(
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        Icon(Icons.photo_album),
                        SizedBox(
                          width: 10,
                        ),
                        Text(
                          "相册",
                          style: TextStyle(fontSize: 20),
                        )
                      ],
                    )),
              ),
              Container(
                alignment: Alignment.center,
                height: 60,
                child: GestureDetector(
                  onTap: () {
                    Navigator.pop(context);
                  },
                  child: const Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                      Icon(Icons.cancel_outlined),
                      SizedBox(
                        width: 10,
                      ),
                      Text(
                        "取消",
                        style: TextStyle(fontSize: 20),
                      )
                    ],
                  ),
                ),
              )
            ],
          ),
        );
      });
}
